package edu_xy.hm_02.slice;

import edu_xy.hm_02.ResourceTable;
import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;
import ohos.agp.components.Component;
import ohos.agp.components.Text;
/*
    * 页面由两部分构成
    * 页面布局代码   xml
    * 后台逻辑代码   java

*/

public class MainAbilitySlice02 extends AbilitySlice {
    Text text01 = null;
    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
        // 所关联的页面布局代码  xml
        super.setUIContent(ResourceTable.Layout_ability_main_02);
        text01 = (Text)this.findComponentById(ResourceTable.Id_text_02_01);
        text01.setClickedListener(this::clickedListenerText01);
        text01.setDoubleClickedListener(this::doubleclickedListenerText01);

    }

    private void doubleclickedListenerText01(Component component) {
        text01.stopAutoScrolling();  //停止
    }

    private void clickedListenerText01(Component component) {
        text01.startAutoScrolling();  //启动
    }

    @Override
    public void onActive() {
        super.onActive();
    }

    @Override
    public void onForeground(Intent intent) {
        super.onForeground(intent);
    }
}
